<?php

class Marcas_model extends CI_Model {
    public function __construct() {
        $this->load->database();
    }
    
    public function set($datos) {
        $this->db->insert('marcas', $datos);
        return $this->db->insert_id();
    }
    
    public function gets() {
        $query = $this->db->query("SELECT *
                                    FROM
                                        marcas
                                    ORDER BY
                                        marca");
        return $query->result_array();
    }
    
    public function get($idmarca) {
        $query = $this->db->query("SELECT *
                                    FROM
                                        marcas
                                    WHERE
                                        idmarca = '$idmarca'");
        return $query->row_array();
    }
    
    public function update($datos, $id) {
        $this->db->update('marcas', $datos, array('idmarca' => $id));
    }
}
?>
